



/**
 * 初始化地图数据
 */
function initMap() {
	var map = new BMap.Map("mapDiv");
	map.centerAndZoom(new BMap.Point(120.2099600000, 30.2139150000), 15);
	map.addControl(new BMap.MapTypeControl());
	map.enableScrollWheelZoom(true);
	addMarker(new BMap.Point(120.2099600000, 30.2139150000));

	var content = '<div style="margin:0;line-height:20px;padding:2px;">'
			+ '<img src="../img/baidu.jpg" alt="" style="float:right;zoom:1;overflow:hidden;width:100px;height:100px;margin-left:3px;"/>'
			+ '地址：北京市海淀区上地十街10号<br/>电话：(010)59928888<br/>简介：百度大厦位于北京市海淀区西二旗地铁站附近，为百度公司综合研发及办公总部。'
			+ '</div>';

	var searchInfoWindow = null;
	searchInfoWindow = new BMapLib.SearchInfoWindow(map, content, {
		title : "dsfa",
		width : 290,
		height : 105,
		panel : "panel",
		enableAutoPan : true,
		searchTypes : [ BMAPLIB_TAB_SEARCH, BMAPLIB_TAB_TO_HERE,
				BMAPLIB_TAB_FROM_HERE ]
	});
}


/**
 * 添加地图标记
 * @param point
 */
function addMarker(point) {
	var marker = new BMap.Marker(point);
	map.addOverlay(marker);
	marker.setAnimation(BMAP_ANIMATION_BOUNCE);
	marker.addEventListener("click", function(e) {
		searchInfoWindow.open(marker);
	})
}

/**
 * 初始化分享到
 */
function initJiaThis(){
	var jiathis_config={
				siteNum:3,
				sm:"cqq,weixin,tsina",
				url:"http:www.baidu.com",
				summary:"sumary",
				title:"titletitle #huati#",
				boldNum:3,
				showClose:true,
				shortUrl:false,
				hideMore:false
			}
}

/**
 * 初始化首页新闻模块
 */
function initNews(path){
	$.ajax({
		type : "GET", 
		url : path+"newsAction_list.action?page=1&rows=5&fr=index",
		dataType : 'json',  
		success : function(result) {
			var data=result.data;
			for(var i=0;i<5;i++){   
				var $ele=$('<li><h5><a style="float:left;" href="'+data[i].link+'" id="index_news_title">'+data[i].title+'&nbsp;&nbsp;&nbsp;&nbsp; </a><img style="width:15px;height:15px;" src="../images/index/riqi.png"></img> <small> '+data[i].newsTime+'</small> </h5> <div class="news_summary" id="index_news_summay">'+data[i].summary+'</div></li>')
				$('#index_news_ul').append($ele);
			}
		}
	});
}
/**
 * 初始化最新博客模块
 */
function initBlogs(path){ 
	$.ajax({
		type : "GET", 
		url : path+"technologyBlogAction_list.action?page=1&rows=7&fr=index",
		dataType : 'json', 
		success : function(result) {
			var data=result.data;
			for(var i=0;i<data.length;i++){   
				var datetime=data[i].createTime;
				// 获取格式化日期
//				var datetime=new Date(data[i].createTime.year,data[i].createTime.month,data[i].createTime.date,data[i].createTime.hours,data[i].createTime.minutes,data[i].createTime.seconds).format("( MM/dd hh:mm )")
				
				var $ele=$('<li><h5><a style="float:left;" href="blog_getById.action?id='+data[i].uuid+'" id="index_blog_title">'+data[i].title+'&nbsp;&nbsp;&nbsp; </a><small> <img style="width:15px;height:15px;" src="../images/index/zuozhe.png"></img>&nbsp;&nbsp;'+data[i].userNickName+" "+datetime+'</small> </h5> <div class="news_summary" id="index_blog_subtitle">'+data[i].subtitle+'</div></li>')
				$('#index_blog_ul').append($ele);
			}
		}
	});
}

function initIntroduce(){
	var path="/geek/user_getRedisV.action?rediskey=introduce:text";
	$.ajax({
		type : "GET",
		url : path,
		dataType : 'json',
		success : function(result) {
			
			var intro=result.redisvalue;
			$("#introduce").html(intro);
		}
	});
}
